using System;
using System.Collections.Generic;
using System.Text;

   using NUnit.Framework;
   using TestClass = NUnit.Framework.TestFixtureAttribute;
   using TestMethod = NUnit.Framework.TestAttribute;
   using TestInitialize = NUnit.Framework.SetUpAttribute;
   using TestCleanup = NUnit.Framework.TearDownAttribute;
   using ClassInitialize = NUnit.Framework.TestFixtureSetUpAttribute;
   using ClassCleanup = NUnit.Framework.TestFixtureTearDownAttribute;
using Blazing.BusinessObjects.Locations;


namespace BusinessObjectTests.Reservations
{
    [TestClass]
    public class AddressTests : NHibernateInMemoryTestFixtureBase
    {
        private void CheckValues(Address obj, Address newObj)
        {
            Assert.AreEqual(obj.ID, newObj.ID);
            Assert.AreEqual(obj.Address1, newObj.Address1);
            Assert.AreEqual(obj.Address2, newObj.Address2);
            Assert.AreEqual(obj.Address3, newObj.Address3);

            Assert.AreEqual(obj.Postcode, newObj.Postcode);
            Assert.AreEqual(obj.Suburb, newObj.Suburb);
            Assert.AreEqual(obj.AddressType, newObj.AddressType);
            Assert.AreEqual(obj.RowStamp, newObj.RowStamp);
        }

        [TestMethod]
        public void CreateAddress()
        {
            Address obj = BusinessObjectFactory.CreateAndFillAddress();
            obj.AddressType = BusinessObjectFactory.CreateAndFillAddressType();
            obj.AddressType.Save();
            obj.Country = BusinessObjectFactory.CreateAndFillCountry();
            obj.Country.Save();
            obj.Save();

            Address obj2 = Address.Load(obj.ID);
            Assert.IsNotNull(obj2);

            CheckValues(obj, obj2);

            obj.Delete();
            obj.Save();
        }
    }
}
